
/**
** \file       exec_else_clause.c
**
** \brief      this function execute else_clause rule
**
** \author     Ben M'rad Hanna, Laterem Hamza, Boillot Ulysse, De Olivera
**             Guillaume and Nguyen Viet Dung
**
** \version    1.0
**
** \date       23 November 2010
**
*/

#include "execution.h"

int     exec_else_clause(struct else_clause   *node)
{
  if (node->in_if != NULL)
  {
    if (exec_cmpdlist(node->in_if) != 0)
      return (1);

    if (node->in_then != NULL)
    {
      if (exec_cmpdlist(node->in_then) != 0)
        return (1);
      if (node->else_clause != NULL)
        return (exec_else_clause(node->else_clause));

      return (0);
    }
    return (1);
  }

  else
  {
    if (node->in_else != NULL)
    {
      if (exec_cmpdlist(node->in_else) != 0)
        return (1);
      return (0);
    }
    return (1);
  }
}
